<template>
<view class="page-all">
	<Header title="选择学校" bgColor="#fff" :leftIconSize="20" ></Header>
	<view class="search-content">
		<view class="left">
			<uv-search placeholder="学校名称" bgColor="#fff" v-model="keyword" :showAction="false"></uv-search>
		</view>
	</view>
	<!--学校列表-->
	<view class="school-list">
		<uv-radio-group v-model="radiovalue">
			<view class="container">
				<view class="item"  v-for="(item,index) in dataList" :key="index">
					<view class="radio">
						<uv-radio :name="item.id" >
							<template #default><view class="name">{{item.name}}</view></template>
						</uv-radio>
					</view>
				</view>
			</view>
			
		</uv-radio-group>
	</view>
	<!--筛选弹层-->
	
	<view class="check-bottom-box" @click.stop>
	  <button class="sure-button" @click.stop="submit()">确认</button>
	</view>
	
</view>
</template>

<script setup>
	import {reactive, ref} from 'vue'
	const radiovalue = ref('')
	const dataList=reactive([
		{id:'1',name:'校园食品安全联合检查'},
		{id:'2',name:'学校食品安全隐患大排查'},
		{id:'3',name:'2024年春季校园食堂检查'},
		{id:'4',name:'学校安全检查'},
		{id:'5',name:'2023年秋季食品安全隐患排查'},
		{id:'6',name:'2022年秋季食品安全检查'},
		{id:'7',name:'2022年春季食品安全检查'},
		{id:'8',name:'2021年秋季食品安全检查'}
	])
	
	
	
	//返回把选中指标数据传回
	function submit(){
		uni.navigateBack({
		  delta: 1,
		  success: function(res) {
			let currentObj = dataList.filter((item=>item.id == radiovalue.value))
		    uni.$emit('indexData', currentObj)
		  }
		})
	}
</script>

<style scoped>
	.search-content .left{
		margin-right: 0;
	}
	
</style>